public class Test {
    public static void main(String[] args) {
//        Pet a = new Pet();
//        Bird b = new Bird("Dog");
//        b.enjoy();
//        a = b;
//        a.enjoy();
//
//        Bird c = new Bird("Dog2");
//        Bird d = c;
//        c.enjoy();
//        d.enjoy();
//        d.enjoy();
//        d.setName("Dog3");
//        c.enjoy();
    }
}
class Pet {
    String name;
    public Pet() {this.name = name;}
    void enjoy() {
        System.out.println(this.name + "开心...");
    }
    public void setName(String name) {this.name = name;}
}
class Dog extends Pet {
    String name;
    public Dog(String name) {this.name = name;}
    void enjoy() {
        System.out.println(this.name + "旺旺");
    }
    public void setName(String name) {
        this.name = name;
    }
}